## DESCRIPTION
## Vector Calculus: Basic vector operations
## ENDDESCRIPTION

## KEYWORDS('vector calculus', 'vector operations')

## DBsubject('WeBWorK')
## DBchapter('WeBWorK Tutorial')
## DBsection('Fort Lewis Tutorial 2011')
## Date('01/30/2011')
## Author('Paul Pearson')
## Institution('Fort Lewis College')
## TitleText1('')
## EditionText1('')
## AuthorText1('')
## Section1('')
## Problem1('')


##############################
#  Initialization

DOCUMENT(); 

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"parserVectorUtils.pl",
"unionLists.pl",
);

TEXT(beginproblem());


#############################
#  Setup

Context("Vector");

$U = non_zero_vector3D(-9,9,1);
$V = non_zero_vector3D(-9,9,1);

# value works only for vectors of constants
@Uarray = $U->value; 
$Ucomp2 = $Uarray[1];

$UdotV = $U . $V;
$UcrossV = $U x $V;
$Vlength = norm( $V );
$Vunit = unit($V);

#
#  Prevent students from entering the dot and 
#  cross products, and the vector functions
#  norm and unit.
#
Context()->operators->undefine(".","><");
Context()->functions->disable("Vector");


#############################
#  Main text

Context()->texStrings;
BEGIN_TEXT
Suppose \( \vec{u} = $U \) and \( \vec{v} = $V \). 
\{ BeginList('OL', type=>'A') \}

$ITEM The second component of \( \vec{u} \) is 
\{ ans_rule(20) \}

$ITEMSEP
$ITEM \( \vec{u} \cdot \vec{v} = \) 
\{ ans_rule(20) \}

$ITEMSEP
$ITEM \( \vec{u} \times \vec{v} = \) 
\{ ans_rule(20) \}

$ITEMSEP
$ITEM \( \left|\left| \vec{v} \right|\right| = \) 
\{ ans_rule(20) \}

$ITEMSEP
$ITEM Enter a unit vector in the direction of \( \vec{v} \).
\{ ans_rule(20) \}

$ITEMSEP
$ITEM Enter a vector parallel to \( \vec{v} \).
\{ ans_rule(20) \}

$ITEMSEP
$ITEM Enter a vector in the same direction as \( \vec{v} \).
\{ ans_rule(20) \}

\{ EndList('OL') \}
END_TEXT
Context()->normalStrings;


############################
#  Answers

$showPartialCorrectAnswers = 1;


ANS( $Ucomp2->cmp() );
ANS( $UdotV->cmp() );
ANS( $UcrossV->cmp() );
ANS( $Vlength->cmp() );
ANS( $Vunit->cmp() );
ANS( $V->cmp( parallel=>1 ) );
ANS( $V->cmp( parallel=>1, sameDirection=>1 ) );


############################
#  Solution

Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;

COMMENT("MathObject version.");

ENDDOCUMENT();

